<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript">
		window.onload=function(){
			var	box1=document.getElementsByClassName('box1')[0]
				box2=document.getElementsByClassName('box2')[0];
				// info=document.getElementsByTagName('span');
				is=true;
				box1.onclick=function(){
					if (!is) {
						box1.innerHTML=box2.innerHTML;
						box2.innerHTML="";
						is=true;
					};
					// info.style.display="none";
					// alert('message');
				}
				box2.onclick=function(){
					if (is) {
						box2.innerHTML=box1.innerHTML;
						box1.innerHTML="";
						is=false;
					};
				}


		}
	</script>
	<style type="text/css">
		.box1{
			width: 200px;
			height: 200px;
			background-color: red;
		}
		.box2{
			width: 200px;
			height: 200px;
			background-color: green;
		}

	</style>
</head>
<body>
	<div class="box1"><span>hello</span></div>
	<div class="box2"></div>
</body>
</html>